package com.qf.day02;

import java.util.Random;
import java.util.Scanner;

public class zy01 {
    public static void main(String[] args) {
        Random random = new Random();
        Scanner sc = new Scanner(System.in);
        int min = 2000;
        int max = 10000; //0-8001 2000-10001
       int ran = random.nextInt(max-min+1)+min;
        System.out.println("本次的幸运数为:"+ran);
        for (int i = 0; i < 5; i++) {
            System.out.println("请输入第"+(i+1)+"次猜的数字");
            int i1 = sc.nextInt();
            if(i1==ran){
                System.out.println("恭喜您中奖了,获得了此奖品。");
                break;
            }else {
                if(i==4){
                    System.out.println("很可惜，你没有获得奖品，竞猜结束。");
                }else {
                    System.out.println("很遗憾您没有中奖，您还有"+(5-(i+1))+"次机会");
                }
            }
        }
    }
}
